package com.bw.visit

import androidx.lifecycle.MutableLiveData
import com.bw.lib_base.entity.VisitBean
import com.bw.lib_base.entity.VisitBeanItem
import com.bw.lib_base.mvvm.BaseViewModel
import com.bw.lib_base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class VisitViewModel @Inject constructor(val apiService: ApiService): BaseViewModel() {
    val visitData = MutableLiveData<VisitBean>()
    fun getVisit(){
        httpRequest({apiService.getVisit()},visitData::postValue)
    }

    fun getViewByStatus(status: String){
        httpRequest({apiService.getVisitByStatus(status)}, visitData::postValue)
    }

    fun getVisitByName(name:String){
        httpRequest({apiService.getVisitByName(name)},visitData::postValue)
    }

    val detailData = MutableLiveData<VisitBeanItem>()
    fun getVisitById(id: Int){
        httpRequest({apiService.getVisitById(id)},detailData::postValue)
    }
}